- return unless current_user
- namespace = @project&.namespace || @group
- return unless namespace.present?
- return unless display_namespace_user_cap_reached_alert?(namespace)

- root_namespace = namespace.root_ancestor
- pending_users_link = pending_members_group_usage_quotas_path(root_namespace)
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'
- user_caps_link_start = link_start.html_safe % { url: help_page_path('user/group/manage', anchor: 'user-cap-for-groups') }
- users_pending_approval_link_start = link_start.html_safe % { url: help_page_path('user/group/manage', anchor: 'approve-pending-members-for-a-group') }
- link_end = '</a>'.html_safe

= render Pajamas::AlertComponent.new(title: s_('NamespaceUserCap|Your group has reached its billable member limit'),
  variant: :warning,
  close_button_options: { class: 'js-namespace-user-cap-alert-dismiss',
                          data: { cookie_id: hide_user_cap_alert_cookie_id(root_namespace),
                                  testid: 'namespace_user_cap_alert_dismiss' }}) do |c|
  - c.with_body do
    = s_('NamespaceUserCap|Pending users must be reviewed and approved by a group owner. Learn more about %{user_caps_link_start}user caps%{link_end} and %{users_pending_approval_link_start}users pending approval%{link_end}.').html_safe % { user_caps_link_start: user_caps_link_start, users_pending_approval_link_start: users_pending_approval_link_start, link_end: link_end }
  - c.with_actions do
    = link_button_to s_('NamespaceUserCap|View pending approvals'), pending_users_link, class: 'gl-alert-action', variant: :confirm
